using System;
using System.Collections.Generic;
using System.Text;
using ERP.BusinessEntities.Base;
using ERP.DAL.Factory;
using System.Data;
namespace ERP.BusinessEntities
{

	public class ICInvStockItemsController:BaseBusinessController
	{
		public ICInvStockItemsController()
		{
			dal = FactoryDal.CreateEndDal("ICInvStockItems");
		}

        public ICInvStockItemsInfo GetObject(int iProductID, int iStockID, String strBatchNo, String strLotNo, String strSerialNo)
        {
            String strQuery = String.Format(@"SELECT * FROM ICInvStockItems 
                                                WHERE FK_ICProducts_ID = {0}
                                                AND FK_ICStocks_ID = {1}
                                                AND BatchNo = '{2}'
                                                AND LotNo = '{3}'
                                                AND SerialNo = '{4}'", iProductID, iStockID, strBatchNo, strLotNo, strSerialNo);


            DataSet ds = GetDataset(strQuery);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                return (ICInvStockItemsInfo)GetObjectFromDataRow(ds.Tables[0].Rows[0]);

            return null;

        }
	}
}
